****** *
* *
* *
*****
cout << '*';
cout << ' ';
cout << endl;
union A {which of the following are correct statements for initializing the union?float y;
char *z;
};
a) A p = B; // B is of same type as Ab) A q = x; // x is a float
c) A r = 3.14159;
d) A s = { 79.63 };
e) A t = { "Hi There!" };
f) A u = { 3.14159, "Pi" };
$ sum < inputcauses program sum to be executed; the redirect input symbol (<) indicates that the data in file input (instead
$ random | sumThis causes the sum of the integers produced by random to be calculated. Piping can be performed in UNIX and DOS.
$ random > outFinally, program output can be appended to the end of an existing file by using the append output symbol (>>) (the same symbol is used for UNIX and DOS). For example, to append the output from program random
$ random >> out
$ copy input outputThis command line indicates that file input is to be copied to file output. When the program executes, if argc is not 3 (copy counts as one of the arguments), the program prints an error message and terminates. Otherwise, array argv contains the strings "copy", "input" and "output". The second and third arguments on the command line are used as file names by the program. The files are opened by creating
extern int flag;prior to the variable's use in that file. In the preceding declaration, the storage class specifier extern indicates to the compiler that variable flag is defined
static float pi = 3.14159;creates variable pi of type float, initializes it to 3.14159, and indicates that pi is known only to functions in the file in which it is defined.
174u8358L
28373ul
3.14159LA floating-point constant that is not suffixed is automatically of type double.1.28f
void *calloc( size_t nmemb, size_t size );It receives two arguments--the number of elements (nmemb) and the size of each element (size)--and initializes the elements of the array to zero. The
void *realloc( void *ptr, size_t size );Function realloc takes two arguments--a pointer to the original object (ptr) and the new size of the object (size). If ptr is 0, realloc works identically to malloc. If
union Number {indicates that Number is a union type with members int x and float y.int x;
float y;
};
extern "C" function prototype // single function
extern "C" // multiple functions
{
function prototypesThese declarations inform the compiler that the specified functions are not compiled in C++, so name encoding should not be performed on the functions listed in the linkage specification. These functions can then be linked properly with the program. C++ environments normally include the standard C libraries and do not require the programmer to use linkage specifications for those functions.}
extern "C" function prototype // single functionextern "C" // multiple functions
{
function prototypes
}